package com.wkx.service.impl;/**
 * @className: BookServiceImpl
 * @description: TODO 类描述
 * @author: wkx
 * @date: 2022/4/7
 **/

import com.wkx.mapper.BookMapper;
import com.wkx.pojo.Type;
import com.wkx.service.BookService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @ClassName : BookServiceImpl  //类名

 * @Author : Lenovo //作者
 * @Date: 2022/4/7  20:37
 */
@Service
public class BookServiceImpl implements BookService {

    @Autowired
    BookMapper bookMapper;
    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public void addType(Type type) {
        bookMapper.addType(type);
    }
    @Transactional(readOnly = true)
    @Override
    public List<Type> getTypeList() {
        return bookMapper.getTypeList();
    }

    @Transactional(readOnly = true)
    @Override
    public Type getTypeById(Integer tid) {
        return bookMapper.getTypeById(tid);
    }
    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public void updateType(Type type) {
        bookMapper.updateTypeById(type);
    }

    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public void deleteType(Integer tid) {
        bookMapper.deleteTypeById(tid);
    }
}
